package 程序员代码面试指南.位运算;

public class 判断整数的二级制中第N位是否为1 {

    public static boolean is1InIndexN(int num, int index) {
        return ((num >> (index - 1)) & 1) == 1 ? true : false;
    }

    public static void main(String[] args) {
        System.out.println(is1InIndexN(1, 2));
    }
}
